<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
		<title><?php echo $diy->name;?></title>
		<link rel="stylesheet" href="../static/web/font/css/font-awesome.min.css">
		<link rel="stylesheet" href="../static/web/css/bootstrap.min.css">
		<link rel="stylesheet" href="../static/web/css/admin.css">
	</head>
	<body>
		<form action="diy_list.php" method="post">
			<input type="hidden" name="diyid" value="<?php echo $diyid;?>">
			<table align="center" class="table maintable my-3">
				<tr>
					<td colspan="3" bgcolor="#f5f5f5">自定义表单管理</a> - <?php echo $diy->name;?></td>
				</tr>
				{dede:datalist}
				<?php 
				if (!empty($fields)) {
					$allowhtml = array('htmltext');
					$fields['sta'] = $fields['ifcheck'] == 1 ? '<span class="btn btn-success btn-sm">已审核</span>':'<span class="btn btn-danger btn-sm">未审核</span>';
					echo '<tr bgcolor="#e9ecef"><td width="16%"><input type="checkbox" name="id[]" value="'.$fields['id'].'"><a href="diy_list.php?action=edit&diyid='.$diy->diyid.'&id='.$fields['id'].'" class="ml-2">表单'.$fields['id'].'</a></td><td align="right">'.$fields['sta'].'<a href="diy_list.php?action=edit&diyid='.$diy->diyid.'&id='.$fields['id'].'" class="btn btn-light btn-sm"><i class="fa fa-pencil-square"></i></a></td></tr>';
					foreach($fieldlist as $field=>$fielddata)
					{
						if ($fields[$field]=='') continue;
						if (!in_array($fielddata[1],$allowhtml)) {
							$fields[$field] = dede_htmlspecialchars($fields[$field]);
						}
						echo '<tr><td>'.$fielddata[0].'</td><td>'.$fields[$field].'</td></tr>';
					}
				} else {
					echo '<tr><td>暂无记录</td></tr>';
				}
				?>
				{/dede:datalist}
				<tr>
					<td colspan="3">
						<input type="button" name="select" onclick="selAll()" class="btn btn-success btn-sm" value="全选">
						<input type="button" name="select" onclick="noSelAll()" class="btn btn-success btn-sm mr-2" value="取消">
						<label class="l-height-30 mr-2"><input type="radio" name="action" value="check"> 审核</label>
						<label class="l-height-30 mr-2"><input type="radio" name="action" value="delete"> 删除</label>
						<button type="submit" name="submit" class="btn btn-success btn-sm">提交</button>
						<a href="../apps/diy.php?action=list&diyid=<?php echo $diy->diyid;?>" target="_blank" class="btn btn-success btn-sm">预览</a>
					</td>
				</tr>
				<tr>
					<td colspan="3" bgcolor="#f5f5f5">{dede:pagelist listsize='6'/}</td>
				</tr>
			</table>
		</form>
		<script>
		function selAll(){
			var a = document.getElementsByTagName("input");
			for (var i = 0; i < a.length; i++){
				if (a[i].type == "checkbox") a[i].checked = true;
			}
		}
		function noSelAll(){
			var a = document.getElementsByTagName("input");
			for (var i = 0; i < a.length; i++){
				if (a[i].type == "checkbox") a[i].checked = false;
			}
		}
		</script>
	</body>
</html>